<?php
  session_start();

  $user = $_POST['user'];
  $password = $_POST['password'];

  include 'class_login.php';
  $login = new class_Login;
  $login->getData($user, $password);
  $ok = $login->check_session();
  if ($ok == false)
  {
    $ok = $login->login();
    if ($ok == true)
    {
      header('Location: admin/admin.php');
    } else {
      header('Location: index.php?error=1');
            }
    } else {
      header('Location: admin/admin.php');
    }

?>
